package com.qcby.llmtchstd.controller;

import com.qcby.llmtchstd.entity.Message;
import com.qcby.llmtchstd.common.ResponseResult;
import com.qcby.llmtchstd.entity.Teacher;
import com.qcby.llmtchstd.entity.User;
import com.qcby.llmtchstd.service.UserChatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

@RestController
@RequestMapping("/chat")  // 类级别路径映射
public class UserChatController {
    @Autowired
    private UserChatService userChatService;


    @PostMapping("/save")  // 方法级别路径映射，完整路径为/teacher/login
    public ResponseResult<String> chatSave(@RequestBody Message message) {


        Integer ans = userChatService.chatSave(message);
        if(ans != null){
            return ResponseResult.success("消息保存成功");
        }else {
            return ResponseResult.fail("4003","消息保存失败，请重试");
        }
    }
}
